/*
 * Superclass of 'Patient', 'Doctor', and 'Nurse'
 */
import java.io.Serializable;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.security.MessageDigest;	// This is for security purposes
import java.util.Arrays;

public class Member implements Serializable {
	private String firstName;
	private String lastName;
	private byte[] password;
	private String userName;
	private int ID;
	private String address;
	
	
	//constructor
	public Member(String f, String l, byte[] p, String u, String a, int id) {
        firstName = f;
        lastName = l;
        password = p;
        userName = u;
        ID = id;
        address = a;
}
	
	
	//Getter methods
	public String getFirstName() {
		return firstName;
	}
	
	
	public String getLastName() {
		return lastName;
	}
	
	public String getUserName() {
		return userName;
	}
	
	
	public int getID() {
		return ID;
	}
	
	public byte[] getPassword()
	{
		return password;
		
	}
	
	
	public String getAddress() {
		return address;
	}
	
	
	//Setter methods
	public void setFirstName(String f) {
		firstName = f;
	}
	
	
	public void setLastName(String l) {
		lastName = l;
	}
	
	
	public void setID(int id) {
		ID = id;
	}
	
	public void setPassword(byte[] p)
	{
		password = p;
		
	}
	
	public void setAddress(String a) {
		address = a;
	}
	
	public String toString()
	{
		String str = this.userName + ": " + this.lastName + ", " + this.firstName;
		return str;
	}
	
	// This checkPass has been updated to compare secure message digests 
	// instead of plain-text
	public boolean checkPass(byte[] p)
    {
            if(Arrays.equals(p, this.password))
            {
                    return true;
            }
            
            return false;
    }
	
}
